package cn.gzmli.dtt.common.entity;

import cn.gzmli.dtt.sbzyc.validation.Add;
import cn.gzmli.dtt.sbzyc.validation.Delete;
import cn.gzmli.dtt.sbzyc.validation.Update;
import lombok.Data;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * @Descript
 * @Author xsx
 * @Date 2017/12/25
 */
@Entity
@Table(name = "menu")
@Data
public class Menu implements Serializable {

    private static final long serialVersionUID = 4902946525434511853L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @NotNull(groups = {Update.class,Delete.class})
    private Integer id;

    @ManyToOne
    @JoinColumn(name = "pId", referencedColumnName = "id",insertable=false,updatable=false)
    @OrderBy(value = "orderNo")
    private Menu parent;

    @NotNull(groups = {Update.class,Add.class})
    private String name;

    private String url;
    private Integer orderNo;

    @NotNull(groups = {Update.class,Add.class})
    private Integer isParent;

    private Integer pId;

    private String description;

}
